package com.shangxia.monomer.study.designPatterns.creationType.builder;

import lombok.extern.slf4j.Slf4j;

/**
 * @ProjectName: monomer
 * @ClassName: BuilderDemo
 * @Time: 2021/7/19
 * @Author: zhouy
 * @Description:
 * @Experience:
 */

@Slf4j
public class BuilderDemo {

    public static void main(String[] args) {
        FactoryBuilder factoryBuilder = new DefaultFactoryBuilder();
        Factory factory = factoryBuilder.createFactory("天下", "中原", 18);
        System.out.println(factory.getName());

        /**
         * lombok.Builder 简化版 builder
         */
        Factory factory2 = Factory.builder().name("盟主").size(16).area("武林").build();
        System.out.println(factory2.getArea());
    }
}
